# Maintainer: Naveen M K <naveen@syrusdark.website>

_realname=manimpango
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.1.4
pkgrel=1
pkgdesc="Bindings for Pango for using with Manim. (mingw-w64)"
arch=('any')
url='https://github.com/ManimCommunity/ManimPango'
license=('GPL')
depends=("${MINGW_PACKAGE_PREFIX}-python"
          "${MINGW_PACKAGE_PREFIX}-pango")
makedepends=("${MINGW_PACKAGE_PREFIX}-cython"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/ManimCommunity/ManimPango/releases/download/v${pkgver}/manimpango-${pkgver}.tar.gz")
sha512sums=('269050A917302C554CA59E95EB73D8650217B59E826AED0DAB4787D5DA627A05CA0A3081027C894AAB5A08301BAC213C2BF4061825CC0F4E3DABD9FCBB8FA069')

prepare() {
  # Force cython rebuild
  rm ${_realname}-${pkgver}/manimpango/cmanimpango.c
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {  
  msg "Python build for ${CARCH}"
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
